package com.hkts.beltweigher.salve.service.serviceimpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hkts.beltweigher.salve.entity.EastBeltscalesCumulativedata;
import com.hkts.beltweigher.salve.mapper.EastBeltscalesCumulativedataMapper;
import com.hkts.beltweigher.salve.service.IEastBeltscalesCumulativedataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hml
 * @since 2024-11-18
 */
@Service
@Transactional
public class EastBeltscalesCumulativedataServiceImpl extends ServiceImpl<EastBeltscalesCumulativedataMapper, EastBeltscalesCumulativedata> implements IEastBeltscalesCumulativedataService {


    @Autowired
    private EastBeltscalesCumulativedataMapper eastBeltscalesCumulativedataMapper;

    @Override
    public IPage<EastBeltscalesCumulativedata> selectPage(Page<EastBeltscalesCumulativedata> page, EastBeltscalesCumulativedata eastBeltscalesCumulativedata) {
        QueryWrapper<EastBeltscalesCumulativedata> query = Wrappers.query();
        return eastBeltscalesCumulativedataMapper.selectPage(page, query);
    }


    @Override
    public List<EastBeltscalesCumulativedata> selectList(EastBeltscalesCumulativedata eastBeltscalesCumulativedata) {
        QueryWrapper<EastBeltscalesCumulativedata> query = Wrappers.query();
        return eastBeltscalesCumulativedataMapper.selectList(query);
    }

    @Override
    public List<EastBeltscalesCumulativedata> selectEastBeltsCalesCumulativeDataListGt(Integer id) {
        QueryWrapper<EastBeltscalesCumulativedata> query = Wrappers.query();
        query.lambda().gt(EastBeltscalesCumulativedata::getId,id);
        return eastBeltscalesCumulativedataMapper.selectList(query);
    }

    @Override
    public List<EastBeltscalesCumulativedata> selectYbRunLeiJiListAll() {
        QueryWrapper<EastBeltscalesCumulativedata> query = Wrappers.query();
        return eastBeltscalesCumulativedataMapper.selectList(query);
    }

    @Override
    public EastBeltscalesCumulativedata getByName(String name) {
        QueryWrapper<EastBeltscalesCumulativedata> query=Wrappers.query();
        query.lambda().isNull(EastBeltscalesCumulativedata::getEndTime);
        query.lambda().eq(EastBeltscalesCumulativedata::getName,name);
        EastBeltscalesCumulativedata eastBeltscalesCumulativedata = eastBeltscalesCumulativedataMapper.selectOne(query);
        return eastBeltscalesCumulativedata;
    }
}
